var express = require('express');
var bodyParser = require('body-parser');
var path = require('path');
var app = express();
//静态文件托管
app.use( '/public', express.static( __dirname + '/public/dist') );
app.use(express.static(path.join(__dirname, 'public/dist')));

//body数据
app.use( bodyParser.urlencoded({extended: true}) );
app.all('*', function(req, res, next) {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "X-Requested-With,Content-Type");
    res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
    next();
});
app.use('/api',require('./route/api'));

app.listen(188, function () {
    console.log('运行成功 : 188');
});